package com.lcm.basic.p6.gc;

/**
 * @author Coder-lcm
 * @date 2021/3/31
 */
public class GCdemo {
    public static void main(String[] args) {
        for (int i = 0; i < 4; i++) {
            new GCdemo();
            // 强制进行垃圾回收
//            System.gc(); //方式1
            Runtime.getRuntime().gc(); //方式2
        }
    }

    @Override
    protected void finalize() {
        System.out.println(this + "已被回收");
    }
}
